<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;

class Base extends Controller{
    public function auth(Request $request){
        $auth_id=$request->post('auth_id');
        $id=DB::table('user')->where('username',session('username'))->value('role_id');
        $rows=DB::table('role')->where('id',$id)->value('node_id');
        if($rows==0){
            return 1;
        }
        $str = explode(',',$rows);
        foreach ($str as $v){
            if($v!=$auth_id){
                return -1;
            }else{
                return 1;
            }
        }
    }
}